<?php $this->pageTitle=Yii::app()->name . ' - '.UserModule::t("Registration");
$this->breadcrumbs=array(
	UserModule::t("Registration"),
);
?>

<h1><?php echo UserModule::t("Registration"); ?></h1>

<?php if(Yii::app()->user->hasFlash('registration')): ?>
<div class="success">
<?php echo Yii::app()->user->getFlash('registration'); ?>
</div>
<?php else: ?>

<div class="form">
<?php /*$form=$this->beginWidget('UActiveForm', array(
	'id'=>'registration-form',
	'enableAjaxValidation'=>true,
	'disableAjaxValidationAttributes'=>array('RegistrationForm_verifyCode'),
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
	'htmlOptions' => array('enctype'=>'multipart/form-data'),
));*/
$form=$this->beginWidget('bootstrap.widgets.BsActiveForm', array(
	'id'=>'login-form',
	'htmlOptions' => array('class' => 'js-ajax-form'),
    //'layout' => TbHtml::FORM_LAYOUT_HORIZONTAL,
	'enableClientValidation'=>true,
	'clientOptions'=>array(
		'validateOnSubmit'=>false,
	),
));
?>
<fieldset>
    <legend><?php echo UserModule::t('Register'); ?></legend>
	<?php //echo $form->errorSummary(array($model,$profile)); ?>
	<?php echo $form->textFieldControlGroup($model,'username'); ?>
    <?php echo $form->passwordFieldControlGroup($model,'password',array(
        'hint'=>'Hint: You may login with <kbd>demo</kbd>/<kbd>demo</kbd> or <kbd>admin</kbd>/<kbd>admin</kbd>',
    )); ?>
	<?php echo $form->textFieldControlGroup($model,'verifyPassword'); ?>
	<?php echo $form->textFieldControlGroup($model,'email'); ?>
	
<?php
		$profileFields=$profile->getFields();
		if ($profileFields) {
			foreach($profileFields as $field) {
			 
		if ($widgetEdit = $field->widgetEdit($profile)) {
			echo $widgetEdit;
		} elseif ($field->range) {
			echo $form->labelEx($profile,$field->varname);
			echo $form->dropDownList($profile,$field->varname,Profile::range($field->range));
		} elseif ($field->field_type=="TEXT") {
			echo $form->labelEx($profile,$field->varname);
			echo $form->textArea($profile,$field->varname,array('rows'=>6, 'cols'=>50));
		} else {
			echo $form->textFieldControlGroup($profile,$field->varname,array('size'=>60,'maxlength'=>(($field->field_size)?$field->field_size:255)));
		}
		 ?>
		<?php //echo $form->error($profile,$field->varname); ?>	
			<?php
			}
		}
?>
	<?php if (UserModule::doCaptcha('registration')): ?>
	<div class="">
		<?php //echo $form->labelEx($model,'verifyCode',array('class' => 'control-label required')); ?>
		<div class="controls"><div class="captcha"><div class="widget">
		<?php $this->widget('CCaptcha',array('imageOptions' => array('id' => 'js-recaptcha-link'),'buttonOptions' => array('class' => 'js-normal-link'))); ?>
		</div>
		<?php //echo $form->textField($model,'verifyCode'); ?>
		
		
		<?php //echo $form->error($model,'verifyCode'); ?>
		</div>
		</div>
	</div>
    <?php echo $form->textFieldControlGroup($model,'verifyCode'); ?>
    <div class=""><div class="controls">
    <div class="hint"><?php echo UserModule::t("Please enter the letters as they are shown in the image above."); ?><br/><?php echo UserModule::t("Letters are not case-sensitive."); ?></div>
    </div></div>
	<?php endif; ?>
	
	<div class="control-group success"><div class="controls">
		<?php
		echo BSHtml::submitButton('Submit', array(
			'color' => BSHtml::BUTTON_COLOR_PRIMARY
		));
		?>
	</div>
	</div>
</fieldset>
<?php $this->endWidget(); ?>
</div><!-- form -->
<?php endif; ?>